package com.zhgxi.zf.action;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;

import com.zhgxi.zf.entity.Notice;
import com.zhgxi.zf.service.NoticeService;

@Controller("NoticeAction")
public class NoticeAction {
	@Resource
	private NoticeService noticeService;

	public List<Notice> findAll() {
		return noticeService.findAllNotice();
	}

	public boolean saveNotice(Notice no) {
		return noticeService.saveNotice(no);
	}

	public boolean deleteNotice(Notice no) {
		return noticeService.deleteNotice(no);
	}

	public List<Notice> findByDate(Date d) {
		return noticeService.findByDate(d);
	}

	@InitBinder
	public void InitBinder(WebDataBinder dataBinder) {
		dataBinder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), false));
	}

}
